﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/BaseInfoMaster.master"
    CodeFile="EditConsumer.aspx.cs" Inherits="EditConsumer" CodeFileBaseClass="Frame.Pages.BaseInfomationEditBasePage" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2.Linq, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" rel="stylesheet" href="../Content/Site.css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1 class="DemoTitle">
        <asp:Label ID="lblHeader" runat="server" Text="客户基础信息管理"></asp:Label>
    </h1>
    <div id="DemoArea">
        <div class="Spacer" style="height: 14px;">
        </div>
        注：重要客户的行颜色为红色
        <dx:ASPxGridView ID="gridView" ClientInstanceName="grid" runat="server" Width="100%"
            Font-Size="10pt" AutoGenerateColumns="False" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
            CssPostfix="DevEx" DataSourceID="LSMDSourceMain" KeyFieldName="ConsumerID" OnHtmlRowPrepared="gridView_HtmlRowPrepared"
            OnCustomCallback="gridView_CustomCallback">
            <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                <Header ImageSpacing="5px" SortingImageSpacing="5px">
                </Header>
                <LoadingPanel ImageSpacing="5px">
                </LoadingPanel>
            </Styles>
            <ImagesFilterControl>
                <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                </LoadingPanel>
            </ImagesFilterControl>
            <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                </LoadingPanelOnStatusBar>
                <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                </LoadingPanel>
            </Images>
            <Columns>
                <dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="true">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="grid.SelectAllRowsOnPage(this.checked);" title="Select/Unselect all rows on the page" />
                    </HeaderTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn Name="t_ConsumerID" FieldName="ConsumerID" VisibleIndex="0"
                   CellStyle-HorizontalAlign="Right" ReadOnly="true" Caption="自动编码">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Name="t_CName" FieldName="CName" VisibleIndex="1" CellStyle-HorizontalAlign="Left"
                    Caption="客户姓名">
                    <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Name="t_PhoneNum" FieldName="PhoneNum" VisibleIndex="2"
                    CellStyle-HorizontalAlign="Left" Caption="电话号码">
                    <PropertiesTextEdit MaxLength="50" Native="true" Width="260px">
                    </PropertiesTextEdit>
                    <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Name="t_Position" FieldName="Position" VisibleIndex="3"
                    CellStyle-HorizontalAlign="Left" Caption="头衔">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Name="t_Company" FieldName="Company" VisibleIndex="4"
                    CellStyle-HorizontalAlign="Left" Caption="就职单位">
                    <PropertiesTextEdit MaxLength="100" Native="true" Width="260px">
                    </PropertiesTextEdit>
                    <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Name="t_Address" FieldName="Address" VisibleIndex="6"
                    Visible="false" CellStyle-HorizontalAlign="Left" Caption="地址">
                    <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataMemoColumn Name="t_Remark" FieldName="Remark" VisibleIndex="7" CellStyle-HorizontalAlign="Left"
                    Visible="false" Caption="备注">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataMemoColumn>
                <dx:GridViewDataMemoColumn Name="t_PhoneRemark" FieldName="PhoneRemark" VisibleIndex="7" CellStyle-HorizontalAlign="Left"
                    Visible="false" Caption="备注">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataMemoColumn>
                <dx:GridViewDataTextColumn Name="t_Department" FieldName="Department" VisibleIndex="8"
                    Visible="false" CellStyle-HorizontalAlign="Left" Caption="部门">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn Name="t_Sex" FieldName="Sex" VisibleIndex="9" CellStyle-HorizontalAlign="Right"
                    Caption="性别">
                    <PropertiesComboBox>
                        <Items>
                            <dx:ListEditItem Text="男" Value="1" />
                            <dx:ListEditItem Text="女" Value="0" />
                        </Items>
                    </PropertiesComboBox>
                    <CellStyle HorizontalAlign="Right">
                    </CellStyle>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn Name="t_Car" FieldName="Car" VisibleIndex="10" CellStyle-HorizontalAlign="Left"
                    Visible="false" Caption="车牌/车名/颜色">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataMemoColumn Name="t_Favor" FieldName="Favor" VisibleIndex="11" CellStyle-HorizontalAlign="Left"
                    Visible="false" Caption="喜好，口味">
                    <CellStyle HorizontalAlign="Left">
                    </CellStyle>
                </dx:GridViewDataMemoColumn>
                <dx:GridViewDataComboBoxColumn Name="t_IsVip" FieldName="IsVip" VisibleIndex="12"
                    CellStyle-HorizontalAlign="Right" Caption="重要客户">
                    <PropertiesComboBox>
                        <Items>
                            <dx:ListEditItem Text="是" Value="1" />
                            <dx:ListEditItem Text="否" Value="0" />
                        </Items>
                    </PropertiesComboBox>
                    <CellStyle HorizontalAlign="Right">
                    </CellStyle>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataComboBoxColumn Name="t_RefrenceCompany_ID" FieldName="RefrenceCompany_ID"
                    VisibleIndex="13" CellStyle-HorizontalAlign="Center" Caption="关联单位">
                    <PropertiesComboBox NullDisplayText="无">
                    </PropertiesComboBox>
                    <DataItemTemplate>
                        <dx:ASPxHyperLink ID="ASPxHyperLink1" runat="server" Text='<%# Eval("RefrenceCompany_ID") == null ? "无" : this.GetCompanyName(Eval("RefrenceCompany_ID"))%>'
                            NavigateUrl='<%# Eval("RefrenceCompany_ID") == null ? string.Empty : string.Format("~/ConsumerManage/EditConsumer.aspx?comid={0}",Eval("RefrenceCompany_ID")) %>'>
                        </dx:ASPxHyperLink>
                    </DataItemTemplate>
                    <CellStyle HorizontalAlign="Center">
                    </CellStyle>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn VisibleIndex="14" Caption="修改">
                    <DataItemTemplate>
                        <asp:LinkButton runat="server" Text="修改" CommandName="Update" CommandArgument='<%# Eval("ConsumerID") %>'
                            OnClick="BtnUpdate_Click"></asp:LinkButton>
                    </DataItemTemplate>
                </dx:GridViewDataTextColumn>
            </Columns>
            <Templates>
                <DetailRow>
                    <table style="font-size: 10pt" width="600px">
                        <tr>
                            <td style="white-space: nowrap">
                                部门:
                            </td>
                            <td>
                                <dx:ASPxLabel Width="200px" Font-Size="10pt" ID="View_Department" Wrap="true" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Department") %>'
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                            <td style="white-space: nowrap">
                                车牌/车名/颜色:
                            </td>
                            <td>
                                <dx:ASPxLabel Width="200px" Font-Size="10pt" ID="View_Car" Wrap="true" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Car") %>' CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                        <tr>
                            <td style="white-space: nowrap;">
                                单位名称:
                            </td>
                            <td colspan="3">
                                <dx:ASPxLabel Width="400px" Font-Size="10pt" ID="View_Company" Wrap="true" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Company") %>'
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                        <tr>
                            <td style="white-space: nowrap">
                                地址:
                            </td>
                            <td colspan="3">
                                <dx:ASPxLabel Width="400px" ID="View_Address" Font-Size="10pt" Wrap="true" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Address") %>'
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                        <tr>
                            <td style="white-space: nowrap">
                                喜好，口味:
                            </td>
                            <td colspan="3">
                                <dx:ASPxLabel Width="400px" ID="View_Favor" Wrap="true" Font-Size="10pt" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Favor") %>' CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                        <tr>
                            <td style="white-space: nowrap">
                                备注电话号码:
                            </td>
                            <td colspan="3">
                                <dx:ASPxLabel Width="400px" ID="ASPxLabel1" Wrap="true" Font-Size="10pt" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("PhoneRemark") %>'
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                        <tr>
                            <td style="white-space: nowrap">
                                备注:
                            </td>
                            <td colspan="3">
                                <dx:ASPxLabel Width="400px" ID="View_Remark" Wrap="true" Font-Size="10pt" runat="server"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Text='<%# Eval("Remark") %>'
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                        </tr>
                    </table>
                    <table style="font-size: 10pt" width="600px">
                        <tr>
                            <td>
                                <dx:ASPxButton ID="btnBook" runat="server" Text="预定" Font-Size="10pt" Width="125px"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                    CommandName="book" CommandArgument='<%# Eval("ConsumerID") %>' OnClick="btn_Click">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnConsume" runat="server" Font-Size="10pt" Text="管理消费信息" Width="125px"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                    CommandName="Consume" CommandArgument='<%# Eval("ConsumerID") %>' OnClick="btn_Click">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnReturnVisit" runat="server" Font-Size="10pt" Text="回访" Width="125px"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                    CommandName="ReturnVisit" CommandArgument='<%# Eval("ConsumerID") %>' OnClick="btn_Click">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnMday" runat="server" Font-Size="10pt" Text="纪念日管理" Width="125px"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                    CommandName="Mday" CommandArgument='<%# Eval("ConsumerID") %>' OnClick="btn_Click">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnSMS" runat="server" Font-Size="10pt" Text="短信管理" Width="125px"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                    CommandName="SMS" CommandArgument='<%# Eval("ConsumerID") %>' OnClick="btn_Click">
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </DetailRow>
            </Templates>
            <SettingsDetail AllowOnlyOneMasterRowExpanded="true" ShowDetailRow="true" ShowDetailButtons="true" />
            <StylesEditors ButtonEditCellSpacing="0">
                <ProgressBar Height="21px">
                </ProgressBar>
            </StylesEditors>
            <SettingsEditing EditFormColumnCount="1" />
            <Settings ShowFilterRow="true" />
        </dx:ASPxGridView>
        <dx:LinqServerModeDataSource ID="LSMDSourceMain" runat="server" EnableDelete="true"
            EnableUpdate="true" EnableInsert="true" ContextTypeName="DAL.CMSDALDataContext"
            TableName="BI_Consumer" OnSelecting="LSMDSourceMain_Selecting" />
        <table style="margin-left: 20px" width="300px">
            <tr>
                <td>
                    <dx:ASPxButton ID="BtnDel" runat="server" Font-Size="10pt" Text="删除选中信息" c CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" AutoPostBack="False"
                        UseSubmitBehavior="False" Width="132px">
                        <ClientSideEvents Click="function(s, e) {
	if(confirm('确认进行删除?'))
                        {
	grid.PerformCallback();
    }

}" />
                    </dx:ASPxButton>
                </td>
                <td>
                    <dx:ASPxButton ID="BtnNew" runat="server" Font-Size="10pt" Text="新增、修改客户信息" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" Width="180px"
                        OnClick="BtnNew_Click">
                    </dx:ASPxButton>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
